small fixes for bug on error event