fixes TypeError error thrown from spawn