fixed potential NPE in planners
leak resource fix