Another error in handling bit masks fixed (why did i convert the type mask in the first place? was there some strange effect in JS?)