Fixed some bugs in the main loop

The render doesn't work properly and input doesn't seem to work