Fix Problems with prepared query parameters in nested query