error handling tests and others fixes