afterjs ref fixes