change equipment function with some bugs