fixed bug with message function variable valid that was causing errors