Fixing several issues