fixed a bug in schema
updated queries