fixing onChange event behaviour