Fixed require_relative. Fixes #2976. Fixes #3163.