fixed bugs in rendering