Significant bugs fixed in robot logic