image optimization and some fixing of stuff