fix some random small bugs and improve documentation