fix nonstandard c++ code (casting member functions is illegal), more const-correctness