Fix Bug in Rendering Code