repaired write and check int by added 4ms delay -- suggestion : could avoid the ckeck now for rapidity of excecution