added debug statements to figure out whats wrong