Fixed checks for null items