Fixing null pointer issue on algorithm