really annoying sql bug