Fix body parsing problem. Make more checks before doing file system operations