Put viewport to constant memory
fix some memory leaks