Refactor binding generated casted-this checks