More tests, some updates to error handling