Fixing error handling - 1