Added defensive code