Bugs in openFile fixed. But still some codes malfunctioning.