fix minor bugs, begin to implement deferred rendering