fixes #5807 Error when you refresh the Action Panel

Fixed the issue and pushed the code for review, please check it.