some fixes and adding tests to core