Minor fixes, prepare for tests