Fix check for None
Remove old function