functional test bugs fixes