Bug fix

Some bugs are fixed.