fixes to db queries in CheckLevel.cs