some more fixes and error checking for gpkg remove function