fix a missing include and a couple of warnings.
attempt to fix constness bug