fixed some bugs in renderer