Check if $sites even exists before using it to prevent an "Undefined property" notice