some additional bug fixes and modifications