lock and signedness fix