Fixed NoneType error by correcting initialisation.