Fix render function