refactor code, and correct return true, which may be false because of do_action()
rollback because of MySQL API not merged yet. Still fixes the return true which can be false because of do_action()