up-porting bug-fixes to 0.3.1.