Fix possible NPE
Make method static