Changed reference to $b to $imgname