Fixing a bug, adding some warnings