Small optimizations. Replaced NULL to 0.