a couple bug fixes