added geometry test and fixed some bugs