Hi rocke,
Since you only seem to have a problem when permalinks are on, it may be related to this bug: https://core.trac.wordpress.org/ticket/27015
Since that ticket was logged, some portions of the problem have been fixed in the current release, yet other problems remain. I would normally suggest applying the patch to see if that helps. But the patch has not been updated in some time, so I don't think it can be applied with the usual tools. You could manually copy/paste the relevant code from 27015.3.patch into query.php. Of course this will be likely lost when WP is updated again, but at least you'll know if the problem is a WP bug or something else.