some trivial bug fixes