Added null check (was in outer method before)