Fix format compatibility bug

This patch fixes #3 and fixes #4. Both case add a missing rewind to
ensure the second read is done as the same position than the first one.

Signed-off-by: Thomas Lavergne <thomas.lavergne@reveurs.org>