basic compilation improvements + flush for getting stdout even when exec