few bug fixes and additions