When I widened the areas up a bit the problem sorted itself out so you are probably right Tim. I built the area in the latest snapshot so it might not have worked in earlier versions either.
Now my only problem is it coming off the rails at the last turn (the one with the white blocks in my screenshots) but that could be an intended feature for minecarts that are going too fast to come off at corners.
ok thanks
also thanks to minecraftjson.com for giving me the incorrect command!