Fix issue #36 Class cast exception