fixed isssues with applyDirichlet

working now for n=1
(elementsX+1)*(elementsY+1)<=4096