FIX: alat from CELL_PARAMETERS card was not read correctly. Sometimes it throws cast error.
FIX: I found a bug. If you use strip() with an argument it does not strip the space character or the \n character (at least not in python 3.6.0 which I am using). So I added the remaining characters to the strip command.
Now it works for me.