Applying patch provided by ChathuraD.