Fixed compilation and other errors