I think maniacbug is considered a little outdated. I checked against the library that I linked the documentation for. Will have to look at maniacbug to see what the read method returns.
Will try to look at your code a later to try to find obvious flaws.