Some fixes and minor changes