Correcting error handling.
Better error handling.