fix direction and source bugs