Added additional error checking measures
Fixed filename of error dump