modified the bug in display function