change redirect code for avoiding alert