updated for numpy c-api support