Fixed bug that caused program to break after calling the add method