galary bug fixes,lock fixes