Fixed minor bug in obstacle code