Some fixes and clean ups