fixed type indirections when dereferencing array elements or record fields
implemented type checking for function declarations