improve error code