Rewrite some part for jquery 1.9+