checking dictionaries before accessing, prevents core dump