Add a small optimization, fix a RSP bug.