fixed and compiles (but deadlock :P)