improve readability, NULL error fixed