Fixed by now checking for number of obstacles greater than 0