Fixed two bugs