Corrected database query issues caused by PR #180.