added ns_binding to trap function