Fixed potential errors after changes made by commit cbd97f01f03b869b43828184dc681940c86c1b6a .