Fixed problem with going through array