Fixed compilation errors on Tomboy-Library

Updated the Library code for edge cases and fixed compilation errors which came up with last commit