fixed little sql bug