fixed ai crash with vis code