Fixed msleep and added test for msleep in tests