fix bugs so it works on same code base in local and remote servers