bug fixes and adding missing files