some bug fixes. one known bug left!