Solution to bugs 1