bugfix: variable $dn used multiple times