Added register_ptb_directory and removed the old way. Fixed bugs