fixed redirect logic and added extra parameter to form for redirect