Implemented a few more error cases (untested)