add typecase for weight