Fixes to native query functionality

Change-Id: If5e6b963388ae3b3a3e460c8ce8dab3f28e417c2