fix #298. hopefully I did it the proper way even with this super complicated framework.