Make sure modx will be available in  in callback functions