fixed incorrect cat function