viewer is not 'null', check typeof instead