mesh fix

fixed bug that caused an incorrect mesh to be created, or even crash in
some instances