general bug and security fixes