Fixed a bug in bag and compiled the files