fix bug with location remain static in memory