fixed possible null reference problem