Added error message and proper return to generic_scanner

Improved run loop behavior