Bug fix to sqliteSGP