fixes for #3. Thanks for armyofroot@