a few simple bug fixes and added functionality for query simplification