I had the problem, that an evaluation of the gridfunction only in corners of the element was not working for properly refining the grid.