adding first error handling