Minor bug fix in rendering code