Changed asserts to errors