improve DSN handling somewhat + some bug fixes