added null checks in data_mining.py