Fix buffer overflow in import handler

Thanks Bastiaan Jacques for pointing that out