fixed mongo script and combined it with dbmaster.pl