Fix some errors and replace manual gemm by gemm