Fix ClassCastException. Closes #73