Fix bug in semaphore_init introduced in ce480357eded31db348c7ba52fa889d0d2aa21d8