even more core fixes and cleanup