Revert "some cleanups on error funct"

This reverts commit d14a86d58ff6fc6d43dc2b137b2036ec3028afcf.