fixed many bugs with new file structure