write to correct loc