Z2: make it work under matlab