added if catch for array out of bounds exception
fixed color update