Bug fixes round 1