fix bug pointed out by Bronsa on IRC