added checking if array