Removed debug print and fixed bug.