fix sql in bug509