fixed solve and mesh functions