bug fixes and touchups to merge