minor bug fixes and modification question