minor improvements, corrected data type handling