more error checks and fixed test url