fixing bug with type