Replace asserts with perrors