multiple bug fixes and additions