fix some bug in display code