fix a bug and make 1.5+ compatibile