fix bug with render function