Fix fstab and unmount problems

Fix a problem parsing some recovery.fstab files.
Fixed a problem with MD5 checking that prevented unmounting
after md5 checking.
diff --git a/partitionmanager.cpp b/partitionmanager.cpp
index 67ec84e..2bcbc27 100644
--- a/partitionmanager.cpp
+++ b/partitionmanager.cpp
@@ -61,8 +61,12 @@
 		if (fstab_line[0] != '/')
 			continue;
 
+		if (fstab_line[strlen(fstab_line) - 1] != '\n')
+			fstab_line[strlen(fstab_line)] = '\n';
+
 		TWPartition* partition = new TWPartition();
-		string line(fstab_line);
+		string line = fstab_line;
+
 		if (partition->Process_Fstab_Line(line, Display_Error)) {
 			Partitions.push_back(partition);
 		} else {
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index 90c6016..0b2258a 100644
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -25,11 +25,10 @@
 	size_t pos;
 
 	MD5_File = File + ".md5";
-	if (access(MD5_File.c_str(), F_OK ) != -1) {
+	if (Path_Exists(MD5_File)) {
 		DirPath = Get_Path(File);
-		chdir(DirPath.c_str());
 		MD5_File = Get_Filename(MD5_File);
-		Command = "/sbin/busybox md5sum -c '" + MD5_File + "' > /tmp/md5output";
+		Command = "cd '" + DirPath + "' && /sbin/busybox md5sum -c '" + MD5_File + "' > /tmp/md5output";
 		system(Command.c_str());
 		FILE * cs = fopen("/tmp/md5output", "r");
 		if (cs == NULL) {
@@ -38,6 +37,7 @@
 		}
 
 		fgets(line, sizeof(line), cs);
+		fclose(cs);
 
 		Sline = line;
 		pos = Sline.find(":");
@@ -56,7 +56,6 @@
 			// MD5 is bad, return 0
 			ret = 0;
 		}
-		fclose(cs);
 	} else {
 		//No md5 file, return -1
 		ret = -1;