Fixed various bugs in geometry.c. Connection coefficients are still wrong.