read the contents from file properly