Fixes NoneType bug.