corrected typecasts intransform method and added try/catch