fix to make sure x is always first