Problems about /dev/mapper/cryptswap1 on Karmic

Recently I always get a error mounting /dev/mapper/cryptswap1 when booting. I heard that it was because Ubuntu is trying to mount the swap even before it is created. I added these two lines to /etc/rc.local and the problem is solved.

swapoff -a

swapon -a

Although the error no longer occurs, I still don’t understand why would this happen.