fixing error with NULL array