some fix for contract model and clean code