Fix overflow check
Remove newline from asctime output
Fixed lenght missing null terminator in filename