Autoplay bug fix

Fixed the bug #22.  This pull request resolves all the three issues reported in that bug report.