Implement query method
Fix bug in query parameter