finally returning flag value instead of false