Fixed the None category problem more efficiently.