fixed bug which caused prior flags to be overriden in all_fits (and some other misc stuff)