improve documentation and fix compiler error