fixed some errors with arrays