Fixed class cast exception