Update detect and image code for astropy 0.3