Fixed type check
Remove debug code