ugtrain: fix pure static memory handling

This mainly fixes a segfault in sleep_sec_unless_input() and
improves performance for pure static memory configs.