added debug statements
fixed incorrect string comparison