Fix bugs in display handler.