fixed end of file problem. tested ok