made sure a file is valid json,
also added a debug line