Fixed compilation of SP on Mac (and hopefully Linux too)