Fix issue where post_query and pre_query are overwritten