fix crop function bug