fix for null ref error while checking encoding types.