fixing bug in rendering.