fix possible npe error