Prevent assert on render()

Not really sure why it happens yet. Further investigation is required.