dir before pos, fixed #1293