Fix query on mac osx

fixed #909