fixed bug referencing x[0]