few bug fixes