Fixed bug in play function