bug fixes from last patch