added error handling in getWid