Correcting the function GetLabels

It was printing wrong erro msg