sone sql and scope stuff