partial bug fix for previous commit