more fixxed bugs
safety procedures. revert if ok
trying to fix unsigned-signed warning