fixed bugs in the render