merged more changes from mangoszero