Use MODx.loadPage instead of direct location change.