Fixed possible error-throwing path