Add fixes by Mevan Samaratunga