Fixed the data retaining bug if null is passed