Fixed mistake in method and added test