Update code + fix bug