bug fixes from master