be more careful when reading sinatra environment name

closes #202