Fixed error handling, forgot what branch I was on.