Fixed onChange method