fixing onchange bug