Fix for premature exit