added fix for multiple wid/hei params in query string
fixed error handling, removed debug