Fixed various issues