Strange response behavior of AT command with Elecrow SIM808 shield

Hello everyone, I am having a hard time with a project. Apparently it seems that the SIM808 shield is not behaving as it should be.

For example,

Command = "AT+CGNSINF\r" Response = ,20170709101446.000,23.795255,90.403860,149.600,1.17,234.4,1,,1

which does not match the specification.

Again, if new a AT command is issued later on, previous response show up in the response buffer. Like-

Response = +CGNSINF: 1,1,20170709102949.000,23.794847,90.403707,74.200,0

which is desired response as mentioned in the specification.

Also it should be noted that, the responses are not complete. A response of AT command is always returning 64 characters. I am assuming that the Serial1 has a buffer of 64 characters. I could be wrong.

Now, my questions are- -> Why the module is behaving like this? Is it normal behavior? -> Why AT command response do not match the specification? -> Why desired response comes after another AT command? -> Why responses are 64 characters?

Please help me with the answers. I need them desperately.

UPDATE : Invalid response problem is now solved. The solution is clearing the serial buffers before issuing command. So the first three questions are answered. But the buffer overflow problem still persists.

From How to use this forum:

Post a complete sketch (program code)! If you don't you waste time while people ask you to do that. However, with coding problems, if possible post a "minimal" sketch that demonstrates the problem - not hundreds of lines of code. If the problem goes away in the minimal sketch, it wasn't where you thought it was.

Here are relevant the codes:

const static int bufferLength = 200;
char responseBuffer[ bufferLength ] = { '\0' };
int responseLength;

boolean sendAT(const char* command, const char* expectedResponse, unsigned long timeout, char *responseBuffer, uint8_t* bufferLength)

    uint16_t i = 0;
    memset(responseBuffer, '\0', *bufferLength);
    unsigned long start = millis();

    while (i < *bufferLength && ((millis() - start) < timeout))
        if (Serial1.available())
            responseBuffer[i++] = (char);
        if (strstr(responseBuffer, expectedResponse) != NULL || strstr(responseBuffer, "ERROR") != NULL)
            responseBuffer[i] = '\0';
            *bufferLength = i;
            return true;

    return false;

void setup()
    // ...
void loop()
    responseLength = bufferLength;
    sendAT("AT+CGNSINF\r", "OK", 10000, responseBuffer, &responseLength);