Read file as binary and fixed bugs