Fixing a few remaining bugs