Fix origin checking