Several small bugfixes and documentation fixes