Code cleanup, fixed bug in error override