added debug statements to track down the issue