Some fixes and tweaks