Some fixes and some improvements