Fix a ClassCastException
Merge branch 'master' into withStaticInstance