Fixes a bug and removes a debug statement