fixed #3 (added error handling to input)