fix urls and function call, and add query function