Added null checker to avoid crash