fixed possible npe and possible exception