Fix bug when calling plug.handler() ('task' referenced before assignment)