Fix two rendering bugs and a calculation bug