Maybe it is a limitation of the model itself? I tried your code with llamma3.2:latest and it worked great
llamma3.2:latest