Several minor fixes