Minor optimizations in error()