Fix a problem in replacing x -> x[0]  on all platforms