avoid notice by checking if array