fixed minor type casting issues and minor bug in error detection output message