Fixing throw exception in add method