Fix for http://tracker.modx.com/issues/6138

Sorry I think I added this to the master branch.  See the ticket for the files that were changed.