Optimizations and fix wrong userdata partition size