fix ugly indentation and re-render bug