A little optimization

Do not calculate position of popup message box when not needed to