Adapted to sdk2