Fixed bug that caused a crash trying to add a nil object into an array