bug fixes from last commit