commit some changes imported from mafunzu