fix a bug on three boxes scenario