db stuff and queries
fixed errors