Fix sapi name check to detect if it's on console, ticket #4049