Zero pointer bug fixed