Removed debug messages and add bug fix