fixing issue with class cast.