Signing pys files made more robust, unit tests for signing fixed