Suggested bug fixes

#1 where library failed to be included
#2 where templates are given an sid of -1 but recent updates have
changed that