Fix tests and get rid of errors in favour of exception