fixes/optimizations