minor fixes in SP code