Fixing some bugs.