wrap the code to make it also compatible with AMD