Replaced hack for supporting Dirichlet boundary conditions