trying to fix the class cast exception