fixing error handling syntax