Added check for null in bookmark handling