fix bug, enhance error report a bit