Fixed some bugs in the vision code.