fixed options bug and changed error event