Fix ClassCastException in  sample app