Made plugin use proper hook for catching function.