Fixed more potential NPEs and made some methods static