modified task to make it compatiable in different sdk version