Fixed bugs for resistance in database