Fixed bug where scan would be called on nil