Various bug fixes, adding os.sleep(), bare build fix