Fixes a part of functional bugs