According to an embodiment, the encoder is configured to ensure that for each long-term picture i of a RPS of a picture the value of a flag is equal to 1 when there is at least two reference pictures in a decoded picture buffer with LSBs of the POC equal to the LSBs of the respective long-term picture i. When said flag is equal to 1, the long- term picture i is indicated by the full POC. Furthermore, in a decoder, a parameter indicative of whether the respective long-term picture indication i of the RPS should be indicated by the full POC or by the LSBs of the POC is received. A first condition if the received parameter indicates that the long-term picture indication i should be indicated by the LSBs of POC is checked and then a second condition if there are at least two reference pictures in the decoded picture buffer with POC LSB equal to POC LSB of said long-term picture indication i is checked. If both the conditions are fulfilled, it is determined that the video stream is erroneous.