prevent buffer overflow in filename