Fixed type bug and length bug.