two bug fixes