new function in mytype and bug fix