corrections on crop function