add test 'check-available-stock' #533 and fix #526