fixing bugs found by Android monkey