fix if n < nmaster of remainer calculation for master windows