Fixed bug in levelset to mesh function