Fixed Bugs

Some minor fixes.