working on functions to repair the spatial extent. doesn't work yet