improve modal resize mechanism to work better, especially on phones