fixing several errors