Fix issue MR-422 - Gives error Object reference not set to an instance of an object.