Fixing #25, supports most case