Fixed semantic bugs.