filter nil values to avoid exception