Fixed several rendering bugs