Check isset before accessing array indexes