Fixed bugs & constness errors