minor bug fixes from Pi