fix bug with arrays