pep8 fixes & try-except statement around record creation