Finite-size scaling with modified boundary conditions