fix type and add sleep