fix normalization bug and improve cuda performance