Added null handling