Improved error handling a bit

(still not there yet though..)