Fixed occurences of NULL and removed internal