Fixes couple bugs introduced from previous commit