fix case statement and url construction