bug fixed and add getSid function