Fixing bad argument parsing in render function. Callback should always be last argument and it will be a function if it is there.