Fixed re-rendering bug