several bug fixes / typo