sql bug fixed