Fixing syntax error
Better decoding algorithm, ignoring errors