remove unreachable code from factory