Add code for scalar case(No loop)
Correct variables types