added check for undefined subs array