Fixed incorrect attribute index (causing error).
Added type check (causing error when type is boolean).