fix query and add echos
fix syntax errors