Clear atoms(symbol) and use free_symbols instead

This is related to #5526