fixed bug with arrays