Fixed remaining bugs