fix sql problem