Bug fixes for project 3, project 5 addition