fix one memory over release with viewport
add some tests
small other changes