diff --git a/src/main/java/com/linuxense/javadbf/DBFWriter.java b/src/main/java/com/linuxense/javadbf/DBFWriter.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/linuxense/javadbf/DBFWriter.java
+++ b/src/main/java/com/linuxense/javadbf/DBFWriter.java
@@ -155,9 +155,12 @@ public class DBFWriter extends DBFBase implements java.io.Closeable {
 			this.header.read(this.raf, charset);
 			setCharset(this.header.getUsedCharset());
 
-			/* position file pointer at the end of the raf */
+			// position file pointer at the end of the raf
 			// to ignore the END_OF_DATA byte at EoF
-			this.raf.seek(this.raf.length() - 1); 
+			// only if there are records,
+			if (this.raf.length() > header.headerLength) {
+				this.raf.seek(this.raf.length() - 1);
+			}
 		} catch (FileNotFoundException e) {
 			throw new DBFException("Specified file is not found. " + e.getMessage(), e);
 		} catch (IOException e) {
Fix bug writting in "Sync Mode" to files with only the header