fixed notebook checking code