sleep added to avoid segFault