Fixed segfault in scan1d routine