Revert "Merge pull request #589 from OskarKjellin/patch-1"

This reverts commit ff6e5e119faa992309008db21d34c69e46a6c767, reversing
changes made to d527213022d0e6a2d969268a9a4a7f0d64c7c79f.
Merge pull request #593 from claymccoy/revertChangeDueToClassCastException

Revert "Merge pull request #589 from OskarKjellin/patch-1"