fixed rendering logic