fix bug with multiple cubes