Fix SQL error in getsector