cocnat's bug fix.