Fixing bugs 5477, 5493 and 5498

View commits detail for further information...