Correcting the preventDefault() error