Fixed bug with unitialized varaibel