Fix rendering bugs