added sort
fixed location redirect