fix for bugs that were introduced by the previous commit