Spinoza on teleology: from ontology to moral philosophy