fix auto-complete ClassCastException

fixes #41