fixed 'too many sql variables' bug