corrected refactoring bugs of simple_query