fix functions generated for constrs