add some debug code for crop function