modify popup centering function