Fixed bug and reconstructed code of category