Fixed last flag issue

fixes #3