fixed bug in class render function