ENOMEM can happen several times, so while loop it

seems to fix #6 :-)