fixes in issue 31
Merge pull request #221 from smogon/ff5cde54ec012c50bbf9262124246d11

fixes in issue 31