Fixed problems with virtual functions changing const-ness