It works!

I had to use gen_server:spawn_link and unlink again to make sure the
process was up and running before doing the next thing.

Next to this I fixed some minor bugs.