fixed schema + queries
fixed sql setup script