fix ClassCastException on issues #40