fix sql error and service error