made some improvements in fits.py