Merging fix of https://wso2.org/browse/APPFAC-2627

Please find the code changes herewith this request