Fixed various problems