fixed ine endings, added SAVEQUERIES if debug is on