lot's of bug fixes and extra queries