type handling bug fix