patch ternary operator with isset and add test case for factory additions