added error handling to input fields