fixed many issues with Viewer, compiles statically