fixing error on location array