Fix for Usergrid-22

Link to bug: https://issues.apache.org/jira/browse/USERGRID-22