Fixed bug in rendering