Fixing several minor bugs (4457, 4493 and 4494)