Fixed bugs. /See comment below/