Fix null reference exception during "kpm pack --runtime"

parent #684