optimizations: some safe, some not