Fixed bug with error handling!