bug fixes, now passes check-all