minor changes, fix the bug in remove_handler