Fixed two bugs leading to a wrong initialization