Fixing bug #3730

http://tracker.modx.com/issues/3730
Fixing bug #8909

http://tracker.modx.com/issues/8909
Merge pull request #8 from Jako/patch-6

3730, 8909