Fix bugs attempt 1