some minor corrections to code