fixed bug in checkwriting