bug fixes and functions add