check if array key exists when averaging values (prevents PHP from throwing a notice)