Added a working check. Maybe an overkill in lines, but it can be fixed later