Bugfixed EOF detection, and added a simple test. Also updated sigs.