adding error handling fix #1