trying to resolve errors in crafting code