fix bug pointed out by Jacob Dlougach