Fix constraints regarding document element