buy function not firing