Added cpl error codes to errcheck functions