fixed unregister, lasterror